/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tmp.ac.ui.setting;

import tmp.ac.lib.tools.DBClass;
import ac.uitls.propertiesOperation;
import tmp.ac.lib.tools.uiUtil;
import tmp.ac.lib.tools.util;
import tmp.ac.options.DataItems;
import tmp.ac.options.DataModel;
import tmp.ac.options.urls;
import java.sql.ResultSet;
import java.util.Arrays;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

/**
 *
 * @author ismail
 */
public class usersSetting extends javax.swing.JPanel implements DataItems {

    /**
     * Creates new form usersSetting
     */
    DBClass db = new DBClass();
    propertiesOperation po = new propertiesOperation();
    uiUtil uiu = new uiUtil();

    public usersSetting() {
        initComponents();

        genUpdate();
        usersUpdate();
        permissionsUpdate();

        genUpdate();
        uiu.updatepanelWords(jTabbedPane1.getParent().getComponents());
        // categoriesUpdate();
        // itemsUpdate();

    }

    private void usersUpdate() {
        uiu.fillCombox(usersPermissions_cb, DataModel.PERMISSIONS_TABLE, "id", "title");
        uiu.fillCombox(usersLang_cb, itemsLanguages);
        this.usersTabelUpdat("", "");
        tableusers.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {

                int sel = tableusers.getSelectedRow();
                if (sel != -1) {

                    String domain = tableusers.getValueAt(sel, 0).toString();
                    usersexID = Integer.parseInt(domain);

                    usresItemsUpdate(domain);
                }
            }
        });


    }

    private void genUpdate() {

        jTabbedPane1.setTitleAt(1, "Permissions_tab");
        jTabbedPane1.setTitleAt(0, "users_tab");

    }

    // <editor-fold defaultstate="collapsed" desc="Users Code">
    private void usresItemsUpdate(String id) {

        try {


            String[] usresData = us.getRow("id", id);
            //  uiu.sendMessage(this, id,Arrays.deepToString(usresData) );
            usresUserName_txt.setText(usresData[1]);
            usresPassword_txt.setText("");
            usresPasswordRep_txt.setText("");
            uiUtil.setComBoxSelectonByValue(usersLang_cb, usresData[3]);
            uiUtil.setComBoxSelectonByValue(usersPermissions_cb, usresData[4]);
        } catch (Exception ex) {
            uiu.sendMessage(this, id, ex.getMessage());
        }
    }

    private void usersTabelUpdat(String wherefiled, String whereValue) {
        ResultSet rs = us.getAll(wherefiled, whereValue);
        uiu.TabelUpdat(
                tableusers,
                rs,
                new String[]{"id", po.getWord("userName")},
                new String[]{"id", "userName"},
                new int[]{0});

        db.setCloseCon();
        tableusers.getSelectionModel().setSelectionInterval(0, 0);
    }
    int usersSaveStatus = 0;
    int usersEditStatus = 0;
    int usersexID = 0;
    int usersEditID = 0;
    tmp.ac.engin.setting.usersSetting us = new tmp.ac.engin.setting.usersSetting();
    tmp.ac.engin.setting.permissionsSetting pr = new tmp.ac.engin.setting.permissionsSetting();

    private void UpdateUserDataArray() {
        us.Data = new String[4];
        us.Data[0] = usresUserName_txt.getText();
        us.Data[1] = util.md5(usresPassword_txt.getText());
        us.Data[2] = uiUtil.getComBoxValue(usersLang_cb);
        us.Data[3] = uiUtil.getComBoxValue(usersPermissions_cb);
    }

    private void usersSave() {


        if (usersSaveStatus == 0) {
            uiu.clearPanel(usersPanel.getComponents(), true);
            usersAdd_bt.setText(po.getWord("label.save"));
            usersSaveStatus = 1;
        } else {

            if (usresPasswordRep_txt.getText().equals(usresPassword_txt.getText())) {
                UpdateUserDataArray();
                uiUtil.sendMessage(null, "", Arrays.deepToString(us.Data));
                uiu.sendMessage(this, po.getWord("label.save"), us.addNew());
                usersCancel();

            } else {
                uiUtil.sendError(this, po.getWord("title.error"), po.getWord("message.passwordRepatError"));
            }

        }


    }

    private void usersEdit() {


        if (usersEditStatus == 0) {
            // u.EnablePanel(itemsPanel.getComponents(), true);
            usersUpdate_bt.setText(po.getWord("label.saveUpdate"));
            usersEditID = usersexID;
            usersEditStatus = 1;

        } else {
            if (usresPasswordRep_txt.getText().equals(usresPassword_txt.getText())) {
                this.UpdateUserDataArray();
                uiu.sendMessage(this, po.getWord("label.saveUpdate"), us.UpdateNew(usersEditID));
                usersCancel();
            } else {
                uiUtil.sendError(this, po.getWord("title.error"), po.getWord("message.passwordRepatError"));
            }
        }


    }

    private void usersDelete() {
        int re = uiUtil.sendAlert(this, po.getWord("title.delete"), po.getWord("message.delete"));
        if (re == 0) {
            String data = us.deleteCategory(usersexID);
            if (!data.equals("")) {
                uiUtil.sendMessage(this, po.getWord("title.delete"), "" + data);
                usersCancel();
            }
        }
    }

    private void usersCancel() {
        usersAdd_bt.setText(po.getWord("label.add"));
        usersAdd_bt.setText(po.getWord("label.update"));
        usersEditStatus = 0;
        usersSaveStatus = 0;
        this.usersTabelUpdat("", "");
    }
    // </editor-fold>
    // <editor-fold defaultstate="collapsed" desc="permissions">
    int permissionsSaveStatus = 0;
    int permissionsEditStatus = 0;
    int permissionsexID = 0;
    int permissionsEditID = 0;

    private void permissionsUpdate() {
        uiu.fillList(PermissionsCan_ls, itemsCan);
        uiu.fillList(PermissionsView_ls, itemsFrames);
        this.permissionsTabelUpdat("", "");
        tablepermissions.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {

                int sel = tablepermissions.getSelectedRow();
                if (sel != -1) {

                    String domain = tablepermissions.getValueAt(sel, 0).toString();
                    permissionsexID = Integer.parseInt(domain);

                    permissionsItemsUpdate(domain);
                }
            }
        });


    }

    private void permissionsItemsUpdate(String id) {

        try {


            String[] prsData = pr.getRow("id", id);
            Permissions_txt.setText(prsData[1]);
            uiUtil.setJlistelectonByValue(PermissionsCan_ls, prsData[2]);
            uiUtil.setJlistelectonByValue(PermissionsView_ls, prsData[3]);

            //uiu.sendMessage(this, Arrays.deepToString(prsData), Arrays.deepToString(prsData));

        } catch (Exception ex) {
            uiu.sendMessage(this, id, ex.getMessage());
        }
    }

    private void permissionsTabelUpdat(String wherefiled, String whereValue) {
        ResultSet rs = pr.getAll(wherefiled, whereValue);
        uiu.TabelUpdat(
                tablepermissions,
                rs,
                new String[]{"id", po.getWord("title")},
                new String[]{"id", "title"},
                new int[]{0});

        db.setCloseCon();
        tablepermissions.getSelectionModel().setSelectionInterval(0, 0);
    }

    private void permissionsSave() {


        if (permissionsSaveStatus == 0) {
            uiu.clearPanel(permissionsPanel.getComponents(), true);
            permissionsAdd_bt.setText(po.getWord("label.save"));
            permissionsSaveStatus = 1;
        } else {
            pr.Data = new String[3];
            pr.Data[0] = Permissions_txt.getText();
            pr.Data[1] = uiUtil.getListValue(PermissionsCan_ls);
            pr.Data[2] = uiUtil.getListValue(PermissionsView_ls);

            // uiUtil.sendMessage(this, "", uiUtil.getListValue(PermissionsCan_ls));


            uiu.sendMessage(this, po.getWord("label.save"), pr.addNew());
            permissionsCancel();



        }


    }

    private void permissionsEdit() {


        if (permissionsEditStatus == 0) {
            // u.EnablePanel(itemsPanel.getComponents(), true);
            permissionsUpdate_bt.setText(po.getWord("label.saveUpdate"));
            permissionsEditID = permissionsexID;
            permissionsEditStatus = 1;

        } else {
            pr.Data = new String[3];
            pr.Data[0] = Permissions_txt.getText();
            pr.Data[1] = uiUtil.getListValue(PermissionsCan_ls);
            pr.Data[2] = uiUtil.getListValue(PermissionsView_ls);



            uiu.sendMessage(this, po.getWord("label.saveUpdate"), pr.UpdateNew(permissionsEditID));
            permissionsCancel();
        }


    }

    private void permissionsDelete() {
        int re = uiUtil.sendAlert(this, po.getWord("title.delete"), po.getWord("message.delete"));
        if (re == 0) {
            String data = pr.deleteCategory(permissionsexID);
            if (!data.equals("")) {
                uiUtil.sendMessage(this, po.getWord("title.delete"), "" + data);
                permissionsCancel();
            }
        }
    }

    private void permissionsCancel() {
        permissionsAdd_bt.setText(po.getWord("label.add"));
        permissionsAdd_bt.setText(po.getWord("label.update"));
        permissionsEditStatus = 0;
        permissionsSaveStatus = 0;
        this.permissionsTabelUpdat("", "");
    }

    // </editor-fold>
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        jSplitPane1 = new javax.swing.JSplitPane();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tableusers = new javax.swing.JTable();
        jToolBar1 = new javax.swing.JToolBar();
        first_bt = new javax.swing.JButton();
        perv_bt = new javax.swing.JButton();
        tableLabelData = new javax.swing.JLabel();
        next_bt = new javax.swing.JButton();
        last_bt = new javax.swing.JButton();
        jTextField1 = new javax.swing.JTextField();
        usersPanel = new javax.swing.JPanel();
        usresUserName_txt = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        usresPasswordRep_lb = new javax.swing.JLabel();
        usresPasswordRep_txt = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        usresPassword_txt = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        usersLang_cb = new javax.swing.JComboBox();
        usersPermissions_cb = new javax.swing.JComboBox();
        jLabel6 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jToolBar3 = new javax.swing.JToolBar();
        jToolBar4 = new javax.swing.JToolBar();
        usersAdd_bt = new javax.swing.JButton();
        usersUpdate_bt = new javax.swing.JButton();
        usersCancel_bt = new javax.swing.JButton();
        usersDelete_bt = new javax.swing.JButton();
        jSplitPane2 = new javax.swing.JSplitPane();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        tablepermissions = new javax.swing.JTable();
        jToolBar2 = new javax.swing.JToolBar();
        first_bt1 = new javax.swing.JButton();
        perv_bt1 = new javax.swing.JButton();
        tableLabelData1 = new javax.swing.JLabel();
        next_bt1 = new javax.swing.JButton();
        last_bt1 = new javax.swing.JButton();
        jTextField2 = new javax.swing.JTextField();
        permissionsPanel = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        PermissionsCan_ls = new javax.swing.JList();
        jScrollPane4 = new javax.swing.JScrollPane();
        PermissionsView_ls = new javax.swing.JList();
        jLabel7 = new javax.swing.JLabel();
        jToolBar5 = new javax.swing.JToolBar();
        jToolBar6 = new javax.swing.JToolBar();
        permissionsAdd_bt = new javax.swing.JButton();
        permissionsUpdate_bt = new javax.swing.JButton();
        permissionsCancel_bt = new javax.swing.JButton();
        permissionsDelete_bt = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        Permissions_txt = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();

        jTabbedPane1.setTabPlacement(javax.swing.JTabbedPane.BOTTOM);

        jSplitPane1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        jScrollPane1.setPreferredSize(new java.awt.Dimension(452, 100));

        tableusers.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {},
                {},
                {},
                {},
                {},
                {}
            },
            new String [] {

            }
        ));
        tableusers.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_LAST_COLUMN);
        tableusers.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                tableusersKeyReleased(evt);
            }
        });
        jScrollPane1.setViewportView(tableusers);

        jToolBar1.setFloatable(false);
        jToolBar1.setRollover(true);

        first_bt.setText("first_bt");
        first_bt.setFocusable(false);
        first_bt.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        first_bt.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        first_bt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                first_btActionPerformed(evt);
            }
        });
        jToolBar1.add(first_bt);

        perv_bt.setText("perv_bt");
        perv_bt.setFocusable(false);
        perv_bt.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        perv_bt.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(perv_bt);

        tableLabelData.setText("/");
        jToolBar1.add(tableLabelData);

        next_bt.setText("next_bt");
        next_bt.setFocusable(false);
        next_bt.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        next_bt.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(next_bt);

        last_bt.setText("last_bt");
        last_bt.setFocusable(false);
        last_bt.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        last_bt.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(last_bt);

        jTextField1.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jTextField1PropertyChange(evt);
            }
        });
        jTextField1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTextField1KeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTextField1KeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jTextField1KeyTyped(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
            .addComponent(jToolBar1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE)
            .addComponent(jTextField1, javax.swing.GroupLayout.Alignment.TRAILING)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 402, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jSplitPane1.setLeftComponent(jPanel2);

        usresUserName_txt.setToolTipText("");

        jLabel1.setText("userName_lb");

        usresPasswordRep_lb.setText("passwordRep_lb");

        usresPasswordRep_txt.setToolTipText("");

        jLabel4.setText("password_lb");

        usresPassword_txt.setToolTipText("");

        jLabel5.setText("lang_lb");

        usersLang_cb.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        usersPermissions_cb.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jLabel6.setText("Permissions_lb");

        jLabel8.setText("users_lb");
        jLabel8.setBorder(javax.swing.BorderFactory.createBevelBorder(0));

        jToolBar3.setFloatable(false);

        jToolBar4.setBorder(null);
        jToolBar4.setRollover(true);

        usersAdd_bt.setText("add_bt");
        usersAdd_bt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                usersAdd_btActionPerformed(evt);
            }
        });
        jToolBar4.add(usersAdd_bt);

        usersUpdate_bt.setText("update_bt");
        usersUpdate_bt.setFocusable(false);
        usersUpdate_bt.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        usersUpdate_bt.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        usersUpdate_bt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                usersUpdate_btActionPerformed(evt);
            }
        });
        jToolBar4.add(usersUpdate_bt);

        usersCancel_bt.setText("cancel_bt");
        usersCancel_bt.setFocusable(false);
        usersCancel_bt.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        usersCancel_bt.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        usersCancel_bt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                usersCancel_btActionPerformed(evt);
            }
        });
        jToolBar4.add(usersCancel_bt);

        usersDelete_bt.setText("delete_bt");
        usersDelete_bt.setFocusable(false);
        usersDelete_bt.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        usersDelete_bt.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        usersDelete_bt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                usersDelete_btActionPerformed(evt);
            }
        });
        jToolBar4.add(usersDelete_bt);

        jToolBar3.add(jToolBar4);

        javax.swing.GroupLayout usersPanelLayout = new javax.swing.GroupLayout(usersPanel);
        usersPanel.setLayout(usersPanelLayout);
        usersPanelLayout.setHorizontalGroup(
            usersPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(usersPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(usersPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(usersPanelLayout.createSequentialGroup()
                        .addGroup(usersPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(usersPanelLayout.createSequentialGroup()
                                .addComponent(jLabel6)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(usersPermissions_cb, 0, 195, Short.MAX_VALUE))
                            .addGroup(usersPanelLayout.createSequentialGroup()
                                .addComponent(jLabel5)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(usersLang_cb, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(usersPanelLayout.createSequentialGroup()
                                .addComponent(usresPasswordRep_lb)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(usresPasswordRep_txt))
                            .addGroup(usersPanelLayout.createSequentialGroup()
                                .addComponent(jLabel4)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(usresPassword_txt))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, usersPanelLayout.createSequentialGroup()
                                .addComponent(jLabel1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(usresUserName_txt)))
                        .addGap(54, 54, 54))
                    .addGroup(usersPanelLayout.createSequentialGroup()
                        .addComponent(jToolBar3, javax.swing.GroupLayout.DEFAULT_SIZE, 312, Short.MAX_VALUE)
                        .addContainerGap())))
        );
        usersPanelLayout.setVerticalGroup(
            usersPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(usersPanelLayout.createSequentialGroup()
                .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(4, 4, 4)
                .addComponent(jToolBar3, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(usersPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(usresUserName_txt)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(usersPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(usresPassword_txt)
                    .addComponent(jLabel4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(usersPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(usresPasswordRep_txt)
                    .addComponent(usresPasswordRep_lb))
                .addGap(74, 74, 74)
                .addGroup(usersPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(usersLang_cb, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(usersPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(usersPermissions_cb, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(208, 208, 208))
        );

        jSplitPane1.setRightComponent(usersPanel);

        jTabbedPane1.addTab("tab1", jSplitPane1);

        jSplitPane2.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        jScrollPane2.setPreferredSize(new java.awt.Dimension(452, 100));

        tablepermissions.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {},
                {},
                {},
                {},
                {},
                {}
            },
            new String [] {

            }
        ));
        tablepermissions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_LAST_COLUMN);
        tablepermissions.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                tablepermissionsKeyReleased(evt);
            }
        });
        jScrollPane2.setViewportView(tablepermissions);

        jToolBar2.setFloatable(false);
        jToolBar2.setRollover(true);

        first_bt1.setText("first_bt");
        first_bt1.setFocusable(false);
        first_bt1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        first_bt1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar2.add(first_bt1);

        perv_bt1.setText("perv_bt");
        perv_bt1.setFocusable(false);
        perv_bt1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        perv_bt1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar2.add(perv_bt1);

        tableLabelData1.setText("/");
        jToolBar2.add(tableLabelData1);

        next_bt1.setText("next_bt");
        next_bt1.setFocusable(false);
        next_bt1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        next_bt1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar2.add(next_bt1);

        last_bt1.setText("last_bt");
        last_bt1.setFocusable(false);
        last_bt1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        last_bt1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar2.add(last_bt1);

        jTextField2.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jTextField2PropertyChange(evt);
            }
        });
        jTextField2.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTextField2KeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTextField2KeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jTextField2KeyTyped(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
            .addComponent(jToolBar2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE)
            .addComponent(jTextField2, javax.swing.GroupLayout.Alignment.TRAILING)
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 402, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(jToolBar2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jSplitPane2.setLeftComponent(jPanel3);

        PermissionsCan_ls.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane3.setViewportView(PermissionsCan_ls);

        PermissionsView_ls.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane4.setViewportView(PermissionsView_ls);

        jLabel7.setText("Permissions_lb");
        jLabel7.setBorder(javax.swing.BorderFactory.createBevelBorder(0));

        jToolBar5.setFloatable(false);

        jToolBar6.setBorder(null);
        jToolBar6.setRollover(true);

        permissionsAdd_bt.setText("add_bt");
        permissionsAdd_bt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                permissionsAdd_btActionPerformed(evt);
            }
        });
        jToolBar6.add(permissionsAdd_bt);

        permissionsUpdate_bt.setText("update_bt");
        permissionsUpdate_bt.setFocusable(false);
        permissionsUpdate_bt.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        permissionsUpdate_bt.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        permissionsUpdate_bt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                permissionsUpdate_btActionPerformed(evt);
            }
        });
        jToolBar6.add(permissionsUpdate_bt);

        permissionsCancel_bt.setText("cancel_bt");
        permissionsCancel_bt.setFocusable(false);
        permissionsCancel_bt.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        permissionsCancel_bt.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        permissionsCancel_bt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                permissionsCancel_btActionPerformed(evt);
            }
        });
        jToolBar6.add(permissionsCancel_bt);

        permissionsDelete_bt.setText("delete_bt");
        permissionsDelete_bt.setFocusable(false);
        permissionsDelete_bt.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        permissionsDelete_bt.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        permissionsDelete_bt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                permissionsDelete_btActionPerformed(evt);
            }
        });
        jToolBar6.add(permissionsDelete_bt);

        jToolBar5.add(jToolBar6);

        jLabel2.setText("PermissionsCan_lb");

        jLabel3.setText("PermissionsView_lb");

        Permissions_txt.setToolTipText("");

        jLabel9.setText("title_lb");

        javax.swing.GroupLayout permissionsPanelLayout = new javax.swing.GroupLayout(permissionsPanel);
        permissionsPanel.setLayout(permissionsPanelLayout);
        permissionsPanelLayout.setHorizontalGroup(
            permissionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(permissionsPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(permissionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jToolBar5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 312, Short.MAX_VALUE)
                    .addComponent(jScrollPane4)
                    .addComponent(jScrollPane3)
                    .addGroup(permissionsPanelLayout.createSequentialGroup()
                        .addGroup(permissionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel3)
                            .addComponent(jLabel2))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(permissionsPanelLayout.createSequentialGroup()
                        .addComponent(jLabel9)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(Permissions_txt, javax.swing.GroupLayout.DEFAULT_SIZE, 276, Short.MAX_VALUE)))
                .addContainerGap())
        );
        permissionsPanelLayout.setVerticalGroup(
            permissionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(permissionsPanelLayout.createSequentialGroup()
                .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jToolBar5, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(permissionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(Permissions_txt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addGap(21, 21, 21)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(13, 13, 13)
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(141, Short.MAX_VALUE))
        );

        jSplitPane2.setRightComponent(permissionsPanel);

        jTabbedPane1.addTab("tab1", jSplitPane2);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 558, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(jTabbedPane1)
                    .addContainerGap()))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 501, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(jTabbedPane1)
                    .addGap(0, 0, 0)))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void tableusersKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tableusersKeyReleased
        // TODO add your handling code here:
    }//GEN-LAST:event_tableusersKeyReleased

    private void jTextField1PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jTextField1PropertyChange
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextField1PropertyChange

    private void jTextField1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField1KeyPressed
        // TODO add your handling code here:
        //   catchortCuts(evt);
    }//GEN-LAST:event_jTextField1KeyPressed

    private void jTextField1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField1KeyReleased
        // TODO add your handling code here:
        //  this.categoriesTabelUpdat("title", jTextField1.getText());
    }//GEN-LAST:event_jTextField1KeyReleased

    private void jTextField1KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField1KeyTyped
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextField1KeyTyped

    private void tablepermissionsKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tablepermissionsKeyReleased
        // TODO add your handling code here:
    }//GEN-LAST:event_tablepermissionsKeyReleased

    private void jTextField2PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jTextField2PropertyChange
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextField2PropertyChange

    private void jTextField2KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField2KeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextField2KeyPressed

    private void jTextField2KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField2KeyReleased
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextField2KeyReleased

    private void jTextField2KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField2KeyTyped
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextField2KeyTyped

    private void usersAdd_btActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_usersAdd_btActionPerformed
        // TODO add your handling code here:
        this.usersSave();
    }//GEN-LAST:event_usersAdd_btActionPerformed

    private void usersUpdate_btActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_usersUpdate_btActionPerformed
        // TODO add your handling code here:
        this.usersEdit();
    }//GEN-LAST:event_usersUpdate_btActionPerformed

    private void usersCancel_btActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_usersCancel_btActionPerformed
        this.usersCancel();        // TODO add your handling code here:
    }//GEN-LAST:event_usersCancel_btActionPerformed

    private void usersDelete_btActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_usersDelete_btActionPerformed
        this.usersDelete();        // TODO add your handling code here:
    }//GEN-LAST:event_usersDelete_btActionPerformed

    private void permissionsDelete_btActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_permissionsDelete_btActionPerformed
        // TODO add your handling code here:
        this.permissionsDelete();
    }//GEN-LAST:event_permissionsDelete_btActionPerformed

    private void permissionsCancel_btActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_permissionsCancel_btActionPerformed
        // TODO add your handling code here:
        this.permissionsCancel();
    }//GEN-LAST:event_permissionsCancel_btActionPerformed

    private void permissionsUpdate_btActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_permissionsUpdate_btActionPerformed
        this.permissionsEdit();        // TODO add your handling code here:
    }//GEN-LAST:event_permissionsUpdate_btActionPerformed

    private void permissionsAdd_btActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_permissionsAdd_btActionPerformed
        this.permissionsSave();   // TODO add your handling code here:
    }//GEN-LAST:event_permissionsAdd_btActionPerformed

    private void first_btActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_first_btActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_first_btActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JList PermissionsCan_ls;
    private javax.swing.JList PermissionsView_ls;
    private javax.swing.JTextField Permissions_txt;
    private javax.swing.JButton first_bt;
    private javax.swing.JButton first_bt1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JSplitPane jSplitPane1;
    private javax.swing.JSplitPane jSplitPane2;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JToolBar jToolBar2;
    private javax.swing.JToolBar jToolBar3;
    private javax.swing.JToolBar jToolBar4;
    private javax.swing.JToolBar jToolBar5;
    private javax.swing.JToolBar jToolBar6;
    private javax.swing.JButton last_bt;
    private javax.swing.JButton last_bt1;
    private javax.swing.JButton next_bt;
    private javax.swing.JButton next_bt1;
    private javax.swing.JButton permissionsAdd_bt;
    private javax.swing.JButton permissionsCancel_bt;
    private javax.swing.JButton permissionsDelete_bt;
    private javax.swing.JPanel permissionsPanel;
    private javax.swing.JButton permissionsUpdate_bt;
    private javax.swing.JButton perv_bt;
    private javax.swing.JButton perv_bt1;
    private javax.swing.JLabel tableLabelData;
    private javax.swing.JLabel tableLabelData1;
    private javax.swing.JTable tablepermissions;
    private javax.swing.JTable tableusers;
    private javax.swing.JButton usersAdd_bt;
    private javax.swing.JButton usersCancel_bt;
    private javax.swing.JButton usersDelete_bt;
    private javax.swing.JComboBox usersLang_cb;
    private javax.swing.JPanel usersPanel;
    private javax.swing.JComboBox usersPermissions_cb;
    private javax.swing.JButton usersUpdate_bt;
    private javax.swing.JLabel usresPasswordRep_lb;
    private javax.swing.JTextField usresPasswordRep_txt;
    private javax.swing.JTextField usresPassword_txt;
    private javax.swing.JTextField usresUserName_txt;
    // End of variables declaration//GEN-END:variables
}
